package com.acwing.lc.part1;

/**
 * @author rkc
 * @date 2022/9/9 9:58
 */
public class LC11盛最多水的容器 {

    public int maxArea(int[] height) {
        int ans = 0, l = 0, r = height.length - 1;
        while (l < r) {
            ans = Math.max(ans, (r - l) * Math.min(height[l], height[r]));
            if (height[l] < height[r]) l++;
            else r--;
        }
        return ans;
    }
}
